Inspiration

Every film set has a script supervisor whose entire job is to catch one thing: continuity errors. A character's jacket changes between cuts. A prop disappears. An injury heals three scenes too early. These mistakes cost productions thousands of dollars in reshoots and damage the audience's trust in the story.

I wanted to automate that job — not just flag errors, but build a full AI production intelligence system that a director or producer could open before day one of principal photography and immediately understand every risk standing between them and a clean shoot.

The hackathon theme of agentic AI was the perfect framework. A single LLM call can't do this job — it requires multiple specialists working in sequence, just like a real production team.


What it does

CineOps is a multi-agent AI system for film production intelligence. You paste or upload any screenplay and four AI agents go to work:

  1. Scene Extraction Agent — Parses every scene, extracting location, time of day, characters, props, costumes, and character physical/emotional state.
  2. Continuity Agent — Cross-references all scenes, detecting contradictions: costume changes that happen without explanation, props that vanish, injuries that heal instantly, watches switching wrists.
  3. Risk Agent — Evaluates production risk across five categories (Weather, Schedule, Continuity, Cast, Location), estimating probability, delay hours, and financial exposure for each risk.
  4. Decision Agent — For every HIGH or CRITICAL risk, generates ranked mitigation recommendations with cost impact and risk reduction percentages.

Results land in a Command Center dashboard with four views:

  • Overview — KPI cards showing critical risks, continuity conflicts, financial exposure, and potential delay
  • Scenes — Every scene's full entity breakdown (characters, props, costumes, state)
  • Continuity Timeline — All detected conflicts with confidence scores; mark as intentional, add correction notes, or reopen
  • Risk Center — Ranked risks with AI recommendations; approve or reject each one

All decisions (approved, rejected, intentional, correction notes) persist across page reloads via localStorage, so your production team's work is never lost.


How we built it

  • Frontend: Next.js 16 (App Router, Turbopack) with React 19. All UI is custom — no component library themes, just Tailwind v4 with oklch colour space for the cinematic dark aesthetic.
  • AI Pipeline: Google Gemini (gemini-1.5-pro / gemini-2.5-pro) via the @google/genai SDK. Each agent is a typed JSON-mode call with a normalisation layer that handles malformed responses — markdown fences, wrapped arrays, trailing junk — without crashing.
  • Streaming: The analyze endpoint streams Server-Sent Events (SSE) so the UI shows live agent progress with a cancel button. The entire pipeline is wrapped in a single Prisma transaction so no half-finished project lands in the database.
  • Database: Prisma ORM with PostgreSQL (Neon) in production, SQLite for local development. Full cascade deletes, foreign key indexes, and an orphan cleanup endpoint that runs on every home load.
  • Security: HMAC-SHA256 session tokens (Web Crypto API), timing-safe comparison, same-origin enforcement, per-IP rate limiting on the analyze and login endpoints, and safe error mapping that never leaks provider payloads to the client.
  • Observability: OpenTelemetry traces and metrics exported to Grafana Cloud OTLP — agent latency histograms, risk severity counters, and pipeline completion rates.
  • Deployment: Vercel (serverless), with prisma generate && next build as the build command and Neon PostgreSQL as the persistent store.

Challenges we ran into

  • Gemini response reliability: The model sometimes returns JSON wrapped in markdown fences, or nested inside an object with a scenes key, or with trailing text after the closing bracket. I built a progressive extraction parser that tries up to $n$ end positions before giving up — this alone eliminated ~30% of pipeline failures in testing.
  • Hydration errors: Next.js server-renders pages, but Date.toLocaleDateString() produces different strings on the server (UTC) vs. the browser (local timezone). Every date element needed suppressHydrationWarning + a pinned locale.
  • Nested button HTML: The risk card header was a <button> containing an Undo <button> — invalid HTML that React 19 catches strictly. Fixed by converting the outer element to a <div role="button"> with full keyboard support.
  • SQLite on Vercel: SQLite writes to the filesystem, which Vercel's serverless environment wipes on every cold start. Switching to PostgreSQL required updating the Prisma schema, generating a migration, running it against Neon, and wiring directUrl for non-pooled migration connections — all before the first deployment could succeed.

Accomplishments that we're proud of

  • Built a fully functional, end-to-end multi-agent orchestration engine with real-time SSE streaming inside 24 hours.
  • Successfully connected Google Gemini's reasoning agents to Grafana Cloud via OpenTelemetry OTLP metrics.
  • Designed a zero-crash JSON extraction normalisation pipeline that safely parses unpredictable LLM outputs.
  • Achieved zero data-loss state persistence in the dashboard UI across browser refreshes using local storage synchronization tied to database IDs.

What we learned

  • Multi-agent pipelines need normalisation layers at every boundary — the model is the least reliable part of your stack.
  • Transactional database writes are non-negotiable for agentic workflows. If the Decision Agent fails after the Risk Agent has already written, you need a clean rollback, not orphaned rows.
  • suppressHydrationWarning is the correct tool for intentional server/client differences on a single leaf node — not useEffect + setState, which the linter correctly rejects.
  • Persistent localStorage state keyed by project ID turns a stateless dashboard into something that actually feels like a professional tool.

What's next for CineOps

  • PDF/FDX screenplay import — Direct ingestion support for Final Draft (.fdx) files and industry-standard PDFs.
  • Scene comparison view — Side-by-side diff matrix of conflicting scenes for instant script adjustments.
  • Export to call sheet — Automated single-click export of day-of-shoot briefs directly from the risk and continuity analysis.
  • Collaborative mode — Multi-user support allowing studio executives and line producers to sync decision flags in real time server-side.

Built With

Share this project:

Updates

Submission history