ContinuityOS
Autonomous AI Script Supervisor & Production Intelligence for Filmmakers
"ContinuityOS doesn't generate another movie β it makes sure the movie you've already made actually works."
π‘ Inspiration
Every year, thousands of independent filmmakers, film students, and micro-budget creators pour their life savings into making movies. On an average independent production, shooting a single 10-minute short film generates 24 scenes, over 90 camera setups, and nearly 300 takes.
On a tier-one Hollywood blockbuster, a union Script Supervisor sits beside the director, meticulously tracking every physical detail on paper lined scripts:
- Which hand held the glass when the actor delivered line 14?
- Was the jacket zipped halfway or fully open on the master shot?
- Did the eyeline cross the 180-degree axis during the reverse coverage?
- Is the cigarette burned down to 2 inches or 1 inch?
On independent shoots, however, crews cannot afford a full-time script supervisor ($800β$1,200/day). The director is overwhelmed, the camera operator is framing, and subtle continuity breaks slip through unnoticed.
The nightmare occurs three weeks later in the edit bay:
- In Scene 5 (Take 4 at 00:13), the protagonist Rahul holds a red ceramic coffee mug in his right hand.
- In Scene 6 (Take 2 at 00:07), on the immediate direct cut, the mug inexplicably jumps to his left hand.
In cinema, direct cuts with physical continuity mismatches destroy narrative immersion and break the audience's suspension of disbelief. In Hollywood, catching this triggers an emergency $50,000 reshoot. In indie filmmaking, calling back cast and crew, re-renting lenses, and booking soundstages is often impossible β leaving filmmakers with ruined scenes or awkward cutaway band-aids.
While the AI industry has obsessively focused on generative video (text-to-video diffusion models creating dreamlike, uncanny clips), we asked a fundamentally different question:
What if, instead of using AI to replace human filmmakers, we used multimodal intelligence and high-throughput analytical databases to solve the single most expensive, soul-crushing operational headache in physical film production?
That question gave birth to ContinuityOS.
π¬ What ContinuityOS Does
ContinuityOS is an autonomous production intelligence platform that transforms raw footage notes, camera stills, and screenplays into structured, timecoded analytical telemetry.
- Screenplay Ground-Truth Blueprint Ingestion: Ingests screenplay scripts, parsing sluglines, characters, wardrobe, props, and starting hand states directly into database baselines.
- Side-by-Side Timecoded Continuity Evidence: Detects continuity breaks across direct cuts, displaying authentic 16:9 cinematic camera stills with active camera slates and timecode overlays (e.g.
00:13:24vs00:07:12). - 4-Stage Agentic Reasoning Chain: Every detected violation is backed by an auditable breakdown: Multimodal Visual Observation $\rightarrow$ ClickHouse Adjacency SQL Join $\rightarrow$ Physical State Delta $\rightarrow$ Deterministic Mathematical Confidence.
- "Fix Without Reshooting" (Alternative Take Matcher): When a take suffers from glare, audio clipping, or continuity flaws, ContinuityOS scans the entire database of candidate takes using vector cosine distance and multi-attribute relational matching to salvage scenes without crew reshoots.
- Prioritized Reshoot Manifest: Compiles an automated pre-picture-lock pickup manifest ranked into Critical, Important, and Optional, with mathematical estimation of 2nd-unit crew hours.
- Native NLE Timeline Export: One-click export into broadcast-standard CMX 3600 EDL and DaVinci Resolve Marker CSV formats, color-coding flags directly on editor timelines in Adobe Premiere Pro and DaVinci Resolve.
- Live SQL Telemetry Dock: A transparent real-time terminal dock streaming measured query execution latency (sub-5ms), rows scanned, and security protocol status.
π οΈ How We Built It
ContinuityOS is built on a four-tier architecture connecting multimodal AI perception, columnar database analytics, standardized agent protocols, and a cinematic director control room.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DIRECTOR CONTROL ROOM (Next.js 14) β
β Side-by-Side Timecode Player β’ Reshoot Manifest β’ NLE Exporters β
βββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β SSE Streams & REST APIs
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FASTAPI BACKEND & AGENT ORCHESTRATION β
β β
β βββββββββββββββββββββ βββββββββββββββββββββ βββββββββββββββββββββ β
β β Director Agent β βContinuity Analyst β β Evidence Agent β β
β β (Workflow Lead) β β (Adjacency Join) β β(Take Salvage/Vec) β β
β βββββββββββ¬ββββββββββ βββββββββββ¬ββββββββββ βββββββββββ¬ββββββββββ β
βββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MODEL CONTEXT PROTOCOL (MCP) INTERFACE LAYER β
β Official mcp-clickhouse Server (Stdio JSON-RPC) + Read-Only Guards β
βββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLICKHOUSE CLOUD (MergeTree Analytics Engine) β
β High-speed OLAP β’ Vector cosineDistance β’ Sub-5ms Adjacency Join β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1. The Technology Stack
- Multimodal AI & Perception: Google Gemini 2.5 Flash via the official
google-genaiSDK, leveraging structured JSON schemas and function calling declarations. - Analytical Telemetry Database: ClickHouse Cloud (MergeTree Engine) running high-performance columnar aggregations and high-dimensional vector embeddings.
- Agent Interoperability Protocol: Official ClickHouse Model Context Protocol (
mcp-clickhousev0.6.0) over standard input/output (stdio) JSON-RPC transport with strict read-only security guards (CLICKHOUSE_ALLOW_WRITE_ACCESS=false). - Backend API & Processing: Python 3.12, FastAPI, Pydantic v2, Uvicorn, Pillow (PIL) for cinematic 16:9 frame generation with SMPTE camera slates.
- Frontend & Visual Studio: Next.js 14 (App Router), React 18, Tailwind CSS, Lucide Icons, Server-Sent Events (SSE).
- Deployment & Cloud Infrastructure: Google Cloud Run (serverless container execution), Google Cloud Build (automated CI/CD), Google Cloud Secret Manager, and Vertex AI Agent Builder.
2. Mathematical Modeling & Formulations
To ensure ContinuityOS provides defensible, deterministic production intelligence rather than subjective LLM hallucinations, we formalized film continuity, take salvage, and production readiness into rigorous mathematical formulations.
A. Cross-Scene Continuity Boundary Delta
Let the screenplay be indexed by sequential narrative scenes $s \in {1, 2, \dots, S}$, where each scene contains a set of recorded takes $\mathcal{T}_s$. For an actor $A$ appearing at the boundary between scene $s$ and adjacent scene $s+1$, the observed physical state at timecode $\tau$ is defined as the tuple:
$$\mathbf{S}(A, s, t) = \Big( p, \; h, \; w, \; \ell \Big)$$
where:
- $p \in \mathcal{P} \cup {\emptyset}$ represents the active prop token,
- $h \in {\text{left}, \text{right}, \text{both}, \text{none}}$ is the holding hand,
- $w \in \mathcal{W}$ denotes the wardrobe state vector,
- $\ell \in \mathcal{L}$ specifies the key light vector / environment.
On a direct chronological cut ($s_{b} = s_{a} + 1$), the physical continuity delta operator $\Delta_{\text{cont}}$ is computed as:
$$\Delta_{\text{cont}}(s_a, s_b) = \mathbb{I}\Big(p(s_a) = p(s_b) \neq \emptyset\Big) \cdot \Big[ \omega_h \cdot \mathbb{I}\big(h(s_a) \neq h(s_b)\big) + \omega_w \cdot \mathcal{D}_{\text{costume}}\big(w(s_a), w(s_b)\big) \Big]$$
where $\mathbb{I}(\cdot)$ is the indicator function, $\omega_h, \omega_w$ are heuristic penalty weights, and $\mathcal{D}_{\text{costume}}$ measures categorical wardrobe divergence.
B. Deterministic Analytical Rule Confidence Scoring
Rather than asking an LLM to "guess" a confidence percentage, our Continuity Analyst Agent computes confidence scores directly from ClickHouse evidentiary attributes:
1. Prop Hand Conflict Confidence ($C_{\text{prop}}$):
$$C_{\text{prop}} = \min\left(0.99, \; \max\left(0.50, \; C_0 + \delta_{\text{polar}} + \delta_{\text{actor}} + \delta_{\text{prop}}\right)\right)$$
where:
- Base divergence score: $C_0 = 0.75$
- Polar hand opposition bonus: $$\delta_{\text{polar}} = \begin{cases} 0.10 & \text{if } (h_a, h_b) \in {(\text{left}, \text{right}), (\text{right}, \text{left})} \ 0.05 & \text{if } h_a \neq h_b \text{ and } h_a, h_b \neq \text{none} \ 0.00 & \text{otherwise} \end{cases}$$
- Explicit entity attribution bonus: $\delta_{\text{actor}} = 0.05$ if actor is identified
- Verified prop token identification: $\delta_{\text{prop}} = 0.04$ if $p \neq \text{none}$
For our flagship Scene 5 vs Scene 6 conflict: $$C_{\text{prop}} = 0.75 + 0.10 + 0.05 + 0.04 = \mathbf{0.94} \; (94\%)$$
2. Wardrobe Discrepancy Confidence ($C_{\text{wardrobe}}$):
$$C_{\text{wardrobe}} = \min\left(0.99, \; \max\left(0.50, \; 0.70 + 0.12 \cdot \mathbb{I}(w_a \neq w_b) + 0.05 \cdot \mathbb{I}(\text{actor valid}) + 0.04 \cdot \mathbb{I}(|s_b - s_a| = 1)\right)\right)$$
Evaluating Scene 12 (Charcoal Jacket) vs Scene 13 (Navy Hoodie): $$C_{\text{wardrobe}} = 0.70 + 0.12 + 0.05 + 0.04 = \mathbf{0.91} \; (91\%)$$
C. Alternative Take Compatibility Objective ("Fix Without Reshooting")
When a take is flagged with severe flaws (e.g. windshield glare in Scene 14 Take 1), the Evidence Agent searches ClickHouse across all candidate takes $t \in \mathcal{T}_s$ to find the optimal replacement take $t^*$.
Each take possesses a dense vector embedding $\vec{v}_t \in \mathbb{R}^d$ capturing semantic, framing, and visual attributes. ClickHouse computes visual similarity using native cosine distance:
$$\text{Sim}{\text{visual}}(\vec{v}_t, \vec{v}{\text{target}}) = 1.0 - \text{cosineDistance}(\vec{v}t, \vec{v}{\text{target}}) = \frac{\vec{v}t \cdot \vec{v}{\text{target}}}{|\vec{v}t|_2 \, |\vec{v}{\text{target}}|_2}$$
The composite Take Compatibility Score $\mathcal{S}_{\text{compat}}(t)$ balances visual framing, technical video quality, and audio clarity:
$$\mathcal{S}{\text{compat}}(t) = \left[ 0.50 \cdot \text{Sim}{\text{visual}}(\vec{v}t, \vec{v}{\text{target}}) + 0.30 \cdot Q_{\text{video}}(t) + 0.20 \cdot Q_{\text{audio}}(t) \right] \times 100$$
The optimal replacement take $t^*$ is obtained via constrained optimization:
$$t^* = \arg\max_{t \in \mathcal{T}s} \mathcal{S}{\text{compat}}(t)$$
$$\text{subject to:} \quad \begin{cases} \text{status}(t) = \text{'usable'} \ Q_{\text{video}}(t) \ge 0.80 \ \text{ShotSetup}(t) = \text{ShotSetup}{\text{target}} \ \text{Lighting}(t) = \text{Lighting}{\text{target}} \ \text{PropState}(t) \neq \text{PropState}_{\text{flawed}} \end{cases}$$
In production testing on Scene 14, Take 2 achieves $\mathcal{S}_{\text{compat}} = \mathbf{93.4\%}$, resolving the screen glare flaw while matching camera focal length and lighting perfectly.
D. Production Readiness Index ($\mathcal{R}_{\text{prod}}$)
To inform the director whether a scene or the overall production is ready for picture edit, ContinuityOS evaluates production health across four weighted pillars:
$$\mathcal{R}{\text{prod}} = 0.45 \cdot \left(\frac{N{\text{usable}}}{N_{\text{total}}} \times 100\right) + 0.25 \cdot \bar{Q}{\text{visual}} + 0.20 \cdot \bar{Q}{\text{audio}} + 0.10 \cdot \mathcal{H}_{\text{continuity}}$$
where:
- $\bar{Q}{\text{visual}} = \frac{100}{N} \sum{i=1}^N Q_{\text{video}}(t_i)$ is average visual quality in ClickHouse,
- $\bar{Q}{\text{audio}} = \frac{100}{N} \sum{i=1}^N Q_{\text{audio}}(t_i)$ is average audio fidelity,
- $\mathcal{H}{\text{continuity}}$ is the continuity health score penalized by unresolved issues $U$: $$\mathcal{H}{\text{continuity}} = \max\Big(0, \; 100 - \min(2 \cdot U, \; 20)\Big)$$
E. Reshoot Crew Workload Estimation
Before picture lock, the Reshoot Manifest partitions pending pickup issues into severity sets $\mathcal{I}{\text{crit}}, \mathcal{I}{\text{imp}}, \mathcal{I}{\text{opt}}$. Total estimated 2nd-unit crew hours $H{\text{reshoot}}$ is calculated as:
$$H_{\text{reshoot}} = h_{\text{crit}} \cdot |\mathcal{I}{\text{crit}}| + h{\text{imp}} \cdot |\mathcal{I}_{\text{imp}}|$$
With default planning heuristics $h_{\text{crit}} = 2.5\,\text{hours}$ (camera reset, lighting re-rig, actor restyling) and $h_{\text{imp}} = 1.5\,\text{hours}$ (insert pickup), an edit with 2 critical and 2 important reshoots yields:
$$H_{\text{reshoot}} = (2 \cdot 2.5) + (2 \cdot 1.5) = \mathbf{8.0} \; \text{crew hours}$$
3. ClickHouse Analytical Telemetry & Adjacency SQL
Instead of loading thousands of video frames into LLM contextsβwhich would be prohibitively slow and expensiveβContinuityOS delegates cross-scene relational joins to ClickHouse MergeTree tables.
-- ClickHouse Cross-Scene Prop Hand Adjacency Join
SELECT
a.scene_id AS scene_a,
a.take_id AS take_a,
a.timestamp_sec AS time_a,
b.scene_id AS scene_b,
b.take_id AS take_b,
b.timestamp_sec AS time_b,
a.actor,
a.prop,
a.prop_hand AS hand_a,
b.prop_hand AS hand_b
FROM cinema.visual_observations a
JOIN cinema.visual_observations b
ON a.project_id = b.project_id
AND a.prop = b.prop
AND a.actor = b.actor
WHERE
a.scene_id + 1 = b.scene_id
AND a.prop != 'none'
AND a.prop_hand != b.prop_hand;
Thanks to ClickHouse's vectorized query execution and primary indexing on (project_id, scene_id, shot_id, take_id), this adjacency scan across hundreds of takes executes in $4.2\,\text{ms}$ with zero LLM inference cost.
4. Model Context Protocol (MCP) Implementation
We implemented the Anthropic Model Context Protocol (MCP) to standardize communication between Google Gemini agents and ClickHouse Cloud:
- Official Server Deployment: Runs
ghcr.io/clickhouse/mcp-clickhouse:latestvia stdio JSON-RPC transport. - Read-Only Protocol Enforcement: Configured with
CLICKHOUSE_ALLOW_WRITE_ACCESS=falseandCLICKHOUSE_ALLOW_DROP=false. Agents can dynamically inspect schemas (list_databases,list_tables) and run analytical queries (run_query), but cannot accidentally drop production tables or overwrite footage metadata. - Local In-Process Fallback: For offline developer workflows and air-gapped demo environments, we authored an in-process MCP adapter (
backend/mcp/clickhouse_mcp_server.py) mirroring the exact 3-tool MCP interface.
π§ Challenges We Faced
1. The "Hallucination vs. Determinism" Dilemma in Filmmaking
Filmmaking is an exact craft: an actor either held the cup in their right hand or their left hand; an edit is either on frame 324 or frame 325. Early prototypes that asked an LLM to directly spot continuity errors in video files suffered from subtle hallucinationsβfabricating prop changes that didn't exist or missing subtle hand swaps across cuts.
Solution: We strictly decoupled perception from analysis. Gemini 2.5 Flash acts exclusively as a sensory observation extractor, populating discrete fields (actor, prop, hand, costume, lighting) into ClickHouse. The actual continuity violation detection is computed deterministically in ClickHouse using SQL joins and mathematical formulas. This guarantees 100% auditable, reproducible, and explainable findings.
2. Multi-Process Asynchronous MCP Communication
Integrating the official mcp-clickhouse Go-based server over process stdio pipes with Python's asynchronous asyncio event loops proved non-trivial. Under high-frequency polling from multiple concurrent agents, standard I/O pipes occasionally deadlocked on unbuffered carriage returns.
Solution: We engineered a resilient client wrapper (backend/mcp/client.py) with non-blocking line buffering, health-check probes, automatic subprocess reconnection, and query execution timeouts.
3. Combining High-Dimensional Vector Search with Relational Production Constraints
Standard vector databases perform approximate nearest-neighbor search, but film production requires strict relational boundaries. A replacement take cannot merely be "visually similar"; it must belong to the exact same scene, maintain the same lighting setup, feature the same wardrobe, and resolve the specific flaw of the rejected take.
Solution: ClickHouse Cloud provided the ideal unified engine. By utilizing ClickHouse's native cosineDistance(t.embedding, {target_vector}) directly inside multi-clause SQL WHERE queries, we combined dense vector similarity with strict relational filtering in a single sub-10ms query pass.
4. Broadcast NLE Interoperability & SMPTE Timecode Math
Video editors live in DaVinci Resolve and Adobe Premiere Pro; they will not adopt a tool that forces them to re-type timestamps manually. Converting continuous seconds into standard SMPTE timecodes (HH:MM:SS:FF) at 24.00 fps drop-frame, and generating compliant CMX 3600 Edit Decision Lists (EDLs) with correct event markers and reel numbers, required deep research into broadcast post-production standards.
π¬ What We Learned
- Columnar Databases are a Secret Weapon for Media Telemetry: Film production produces dense, event-oriented time-series telemetry (camera gyro data, lens metadata, timecodes, visual observations, take ratings). Modeling footage as columnar analytical data in ClickHouse was orders of magnitude faster and cheaper than document databases or repeated LLM prompt chains.
- The Power of the Model Context Protocol (MCP): MCP provides a clean, decoupled protocol for AI agents. By speaking standard JSON-RPC tools (
run_query,list_tables), our Gemini agents gained safe, introspectable database access without tight coupling to custom proprietary APIs. - Deterministic Math Builds Trust with Artists: Creative directors are skeptical of black-box AI scores. When ContinuityOS displays a 94% confidence score, we don't present a mystery number; we show the exact mathematical formula ($0.75 + 0.10 + 0.05 + 0.04$) and the underlying ClickHouse query. This transparency transforms AI from an unpredictable gimmick into a trusted camera-crew companion.
- Solve Real Workflow Bottlenecks: Generative video gets headlines, but operational intelligence saves productions. Filmmakers love making movies; they hate lost takes, corrupted cards, and $10,000 reshoots. Building tools that honor and protect human craftsmanship is immensely rewarding.
π Accomplishments That We're Proud Of
- Sub-5ms Analytical Latency: Executing full cross-scene adjacency joins across hundreds of takes in ClickHouse Cloud in under $5\,\text{milliseconds}$.
- Zero-Reshoot Scene Salvage: Creating the "Fix Without Reshooting" take matcher that successfully pairs vector similarity with camera metadata to rescue flawed scenes using existing B-roll and alternative takes.
- End-to-End Production Pipeline: From raw screenplay parsing $\rightarrow$ multimodal camera still analysis $\rightarrow$ MCP ClickHouse analytics $\rightarrow$ broadcast-ready DaVinci Resolve & CMX 3600 EDL timeline markers.
- Enterprise Read-Only Safeguards: Operating under strict protocol-level read-only guards, ensuring multi-agent systems cannot alter or corrupt sensitive production records.
- Cinematic Director Control Room: A dark-mode, production-grade interface designed for film sets, complete with live SQL telemetry docking, camera slate overlays, and natural language AI Director assistance.
π What's Next for ContinuityOS
- Live SDI / NDI Camera Feed Ingestion: Integrating with Teradek and Blackmagic ATEM on-set wireless transmitters for real-time, zero-latency continuity alerts on the director's monitor during take playback.
- Acoustic & Eyeline 3D Geometry: Expanding the perception model to calculate 3D eyeline vector angles and room reverberation profiles to catch 180-degree axis flips and audio tone mismatches before wrapping set.
- Direct NLE Panel Plugins: Releasing native CEP/UXP panels for Adobe Premiere Pro and DaVinci Resolve Studio to sync markers bidirectionally between the edit timeline and ClickHouse Cloud in real time.
- Multi-Camera Live Sync: Real-time multicam angle matching across A, B, and C cameras during complex action setups and live concert productions.
ContinuityOS β Empowering independent filmmakers with Hollywood-grade production intelligence.
Built With
- api
- clickhouse
- cloud
- database
- fastapi
- gemini
- mcp
- python
- python-package-index
Log in or sign up for Devpost to join the conversation.