ClearFrame — Autonomous Rights Clearance & Chain-of-Title Engine
Autonomous rights clearance and chain-of-title investigation for film & TV, powered by Gemini 2.5 on Google Cloud and Parallel AI with an immutable, cryptographically verified ledger.
At a Glance
- Live Deployment: https://clearframe-web-690834564732.us-central1.run.app
- Repository: https://github.com/edish-github/ClearFrame (Apache-2.0)
- Architecture: Gemini 2.5 Pro/Flash on Vertex AI + Parallel AI + Fastify + PostgreSQL 16 + Cloud Run
Inspiration
Every film has a gate between "picture locked" and "distributed", and almost nobody outside the industry knows it exists.
Before a movie or TV show can ship to theaters, Netflix, or Apple TV+, every third-party element inside it must be traced to whoever legally controls it today—then licensed, altered, replaced, or defensibly justified under fair use. The scope is massive:
- Every needle-drop and hummed melody
- Every visible brand logo, storefront, and beverage can
- Every background poster, painting, sculpture, and tattoo
- Every real person depicted, named, or impersonated
- Every archival news clip, stock footage second, and prop typeface
A standard 110-page feature screenplay routinely yields 200 to 400 distinct clearable items.
┌─────────────────┐ ┌──────────────────────┐ ┌─────────────────┐
│ Screenplay Cut │ ───► │ E&O Insurance Gate │ ───► │ Distribution │
│ (200-400 Items) │ │ (The Clearance Bind) │ │ (Revenue Flow) │
└─────────────────┘ └──────────────────────┘ └─────────────────┘
▲
│
Without an auditable report,
underwriters refuse policy.
No policy = No distribution.
The gate is Errors & Omissions (E&O) insurance. Distributors will not accept delivery without an active policy. Underwriters will not write a policy without an exhaustive, verified clearance report. Clearance is not an administrative inconvenience—it is a structural precondition for revenue.
The Problem with Status Quo
Today, clearance runs on manual spreadsheets. A coordinator breaks down the script by hand; paralegals grind through performing rights databases (ASCAP/BMI), trademark registries (USPTO/WIPO), trade press, and probate records for weeks.
This process has three fatal flaws:
- Instant Obsolescence: The moment the director issues a revision (e.g. from shooting draft to blue revision), the spreadsheet is instantly out of date.
- Post-Signoff Blindness: If a music catalog is acquired or an estate lawsuit is filed after sign-off, the production remains completely blind until hit with a cease-and-desist.
- The Dual-Chain Trap: A song is two separate legal properties: the Master Recording (controlled by a label) and the Underlying Composition (controlled by publishers, songwriters, or fractured estates). Licensing one clears nothing. A simple database lookup finds the label. Only an investigation finds the probate dispute sitting on the composition.
The reason this has never been automated is not that the research is difficult—it is that an AI system that confidently hallucinates a rights holder is an active legal liability.
Every architectural decision in ClearFrame follows from that single, non-negotiable constraint.
What It Does
Upload a screenplay PDF. ClearFrame extracts every clearable element, investigates each against the live web, cross-examines its own findings with an adversarial verifier, traces dual chains of title, scores exposure against E&O underwriting standards, drafts licensing outreach behind counsel gates, and renders an immutable, mathematically verifiable clearance binder.
When a revised cut is uploaded, Delta Re-Clearance ensures only what changed is investigated. When rights move post-wrap, Sentinel Watches reopen the finding automatically.
1. System Context & End-to-End Sequence

When a screenplay is submitted, ClearFrame triggers an orchestrated multi-agent sequence across Gemini and Parallel AI:

┌────────────────────────────────────────────────────────────────────────┐
│ EXPERIENCE PLANE React 19 · Vite · Server-Sent Events (SSE) │
│ Producer │ Coordinator │ Legal Counsel │ Underwriting Reviewer │
└────────────────────────────────┬───────────────────────────────────────┘
│ REST + JWT
▼
┌────────────────────────────────────────────────────────────────────────┐
│ CONTROL PLANE Fastify API · Zod Validation · RBAC Gates │
│ │
│ ★ THE API NEVER CALLS A MODEL DIRECTLY ★ │
│ Validates input → INSERTS job to queue → Returns in milliseconds │
└────────────────────────────────┬───────────────────────────────────────┘
│ PostgreSQL Job Queue (SKIP LOCKED)
▼
┌────────────────────────────────────────────────────────────────────────┐
│ EXECUTION PLANE Worker Daemon · Resumable Step Pipeline │
│ │
│ Breakdown ──► Recon ──► Synthesis ──► Verify ──► Trace ──► Assess │
└────────┬───────────────────────────────────────────────────┬───────────┘
│ │
▼ ▼
┌────────────────────┐ ┌────────────────────────┐
│ GEMINI (Vertex) │ │ PARALLEL AI │
│ Reasons & Judges. │ │ Retrieves & Scrapes. │
│ Never retrieves. │ │ Never reasons. │
└────────┬───────────┘ └────────────┬───────────┘
│ │
└───────────────────────┬───────────────────────────┘
▼
┌────────────────────────────────────────────────────────────────────────┐
│ MEMORY PLANE PostgreSQL 16 (14 Tables) · Cloud Storage (GCS) │
│ Findings · Evidence Citations · SHA-256 Ledger · Cost Events · Audits │
└────────────────────────────────┬───────────────────────────────────────┘
│ PostgreSQL LISTEN / NOTIFY
└──────────► SSE Stream ──► Back to UI
2. The Dual-Chain Music Pipeline in Action
Consider a practical example: a screenplay features a cover performance of a 1980s synth-pop track in a key club scene.
┌──────────────────────────────────────────────┐
│ Scene 42 — "Midnight City" (Cover Version) │
└──────────────────────┬───────────────────────┘
│
┌──────────────────────┴───────────────────────┐
▼ ▼
╔═════════════════════╗ ╔═════════════════════╗
║ MASTER CHAIN ℗ ║ ║ COMPOSITION CHAIN © ║
║ (This Performance) ║ ║ (The Written Work) ║
╚═════════╤═══════════╝ ╚═════════╤═══════════╝
│ │
▼ ▼
┌─────────────────────┐ ┌─────────────────────┐
│ Indie Label Roster │ │ Original Publisher │
└─────────┬───────────┘ └─────────┬───────────┘
│ │
│ ▼
│ ┌─────────────────────┐
│ │ Catalog Acquisition │
│ │ (2023 Transfer) │
│ └─────────┬───────────┘
│ │
│ ▼
│ ┌─────────────────────┐
│ │ ESTATE LITIGATION │
│ │ (Disputed Split) │
│ └─────────┬───────────┘
▼ ▼
┌─────────────────────┐ ┌─────────────────────┐
│ Status: CLEAR │ │ Status: CONTESTED │
└─────────┬───────────┘ └─────────┬───────────┘
│ │
└──────────────────────┬───────────────────────┘
▼
┌───────────────────────────┐
│ Clearable ⟺ ALL Chains │
│ Resolve Clear. │
│ │
│ → FLAGGED FOR COUNSEL │
└───────────────────────────┘
A standard search tool sees the indie label and marks the song "cleared." ClearFrame traces both chains independently, surfaces the active probate litigation on the underlying composition, and refuses to close the item without human counsel review.
3. Finding Lifecycle State Machine

Every finding moves through strict, counsel-gated states:
- Two special transitions point backwards: Adversarial Verifier Challenges send findings back for deeper research; Sentinel Watch Alerts reopen previously resolved items if catalog ownership moves after sign-off.
- Authority is enforced server-side: only authenticated Legal Counsel can execute
approved,licensed,replaced, orrejectedactions.
4. Traditional Clearance vs. ClearFrame
| Dimension | Traditional Clearance | ClearFrame Autonomous Engine |
|---|---|---|
| Script Breakdown | Coordinator manually types cues into a spreadsheet (1-2 weeks) | Gemini 2.5 Pro extracts 300+ items anchored to scene, page & context (<60s) |
| Rights Research | Paralegal hours across fragmented registries and trade press | Parallel Search & Task API performs deep, real-time live-web recon |
| Verification | Single reviewer eyeball check | Adversarial Verifier Agent red-teams findings with cited objections |
| Music Title Chains | Often conflates master and composition | Dual-Chain Invariant enforced strictly in schema |
| Cost Shape | Flat, expensive hourly billing ($150-$300/hr) | Tiered micro-dollars: Pennies on trivial items, dollars only on disputed ones |
| Script Re-Cuts | Full manual re-audit of the entire document | Delta Re-Clearance: Unchanged scenes carry over at $0.00 |
| Post-Wrap Safety | Static PDF snapshot; blind to new lawsuits | Sentinel Monitors: Armed watches reopen findings if the web changes |
| Audit Trail | Vulnerable Google Sheets or signed paper | Cryptographic SHA-256 Hash Chaining in PostgreSQL |
| Failure Mode | Missed item → Emergency re-edit, pulled slot, lawsuit | Unresolved item → Surfaced to counsel with costed mitigations |
How We Built It
1. Data Model & Database Invariants

Four core invariants are enforced at the PostgreSQL schema and trigger level rather than in application code:
I. Integer Money Metering
All financial values are stored in 64-bit integer micro-dollars (bigint), where $1\text{ USD} = 1,000,000\text{ micros}$. Token usage from Vertex AI and retrieval units from Parallel are metered atomically:
$$ \text{cost}{\mu} = \left\lfloor 10^{6}\left( \frac{t{\text{in}}}{10^{6}}p_{\text{in}} + \frac{t_{\text{out}}}{10^{6}}p_{\text{out}} + n_{s}\,p_{s} \right) \right\rceil \in \mathbb{Z} $$
The budget meter can never drift from its audit trail because cost logging and balance deduction occur within the exact same database statement.
II. Cryptographic Ledger Immutability

Every state change appends a block to the ledger. Starting from genesis $h_0 = 0^{64}$:
$$ h_n = \text{SHA256}\big(\,\mathcal{C}(\text{production_id},\ \text{seq}n,\ ts_n,\ \text{actor}_n,\ \text{event}_n,\ h{n-1})\,\big) $$
$\mathcal{C}$ is a deterministic canonicalizer with recursively sorted keys. A PostgreSQL trigger unconditionally rejects UPDATE and blocks DELETE unless an explicit administrative purge token is set. Sequence numbers are allocated under PostgreSQL advisory locks (pg_advisory_xact_lock), preventing chain forks during concurrent worker runs.
III. In-Memory Citation Containment
Let $P$ be the set of URLs retrieved by Parallel AI during live research, and let $M$ be the URLs cited by Gemini. The evidence inserted into the database is strictly:
$$ E = {\, e \in M \;:\; \text{url}(e) \in P \,}, \qquad E \subseteq P $$
Any hallucinated citation $M \setminus P$ is discarded at the gateway, and the rejected count is published to the live activity feed. Metadata (title, publish_date, crawl_snapshot) is pulled directly from $P$, making fabricated publication dates unrepresentable in the database.
IV. Review Monotonicity
Let $\mathcal{X}$ be the set of traced title chains and $r$ the assessed risk. Human legal review is required if:
$$ R = \big[\, r = \mathrm{HIGH} \,\big] \;\lor\; \Big[\, \exists\, c \in \mathcal{X} : \text{status}(c) \neq \mathrm{clear} \,\Big] \;\lor\; R_{\text{model}} $$
The AI model can raise the review requirement; it is programmatically barred from lowering it.
2. Delta Re-Clearance Engine

When a director uploads a new cut (Pass $N+1$), ClearFrame calculates:
- Identity Key: $k(f) = \big(\text{category},\ \nu(\text{item})\big)$
- Content Hash: $\eta(f) = \text{SHA256}\big(\nu(\text{scene} \,|\, \text{page} \,|\, \text{context})\big)$
Pass N Findings Pass N+1 Script Cut
┌─────────────────┐ ┌────────────────────┐
│ Scene 14: Song │ ──Match───► │ Scene 14: Song │ ──► Carried untouched ($0.00)
│ Scene 22: Brand │ ──Diff────► │ Scene 22: Logo (Mod)│ ──► Re-queued & researched
│ Scene 85: Poster│ ──Cut─────► │ [Scene Deleted] │ ──► Marked Withdrawn (Preserved)
└─────────────────┘ └────────────────────┘
- Unchanged Items: Carried forward with full evidence and counsel decisions intact ($0.00 spend).
- Modified Items: Re-queued for contextual re-investigation.
- Cut Items: Marked
withdrawn—never deleted from the audit record.
3. Google Cloud & Parallel AI Production Topology

| Technology | Implementation & Role |
|---|---|
Vertex AI (@google/genai) |
Gemini 2.5 Pro for script breakdown, legal risk assessment, dual-chain tracing, and adversarial verification. Gemini 2.5 Flash for high-throughput routing, triage, and outreach drafting. All calls enforce strict responseSchema constraints. |
| Google Cloud Run | Multi-service serverless hosting: clearframe-api (REST & SSE), clearframe-worker (private background daemon), and clearframe-web (React SPA). |
| Google Cloud SQL | Managed PostgreSQL 16 hosting 14 relational tables, advisory locks, and row-level security triggers. |
| Google Cloud Storage | Secure bucket storage for uploaded screenplay PDFs, generated PDF binders, and immutable HTML crawl snapshots. |
| Google Cloud Scheduler | Hourly automated cron triggering internal sweeps, stalled job reaping, and Sentinel watch scheduling. |
| Parallel Search API | Real-time live web recon across public registries, corporate directories, and trade publications. |
| Parallel Task API | Deep structured multi-turn dossiers dispatched when the Verifier challenges an ownership claim. |
| Parallel Monitors | HMAC-verified webhooks triggering automatic finding reopenings upon web changes. |
Technical Challenges & Breakthroughs
I. Concurrency Without Coordination
- Challenge: Multiple background workers simultaneously drain the job queue while appending to a single linear SHA-256 ledger chain. Throughput demands parallelism, but cryptographic integrity demands serial order.
- Breakthrough: We decoupled job claiming from sequence allocation. Workers claim jobs concurrently using
SELECT ... FOR UPDATE SKIP LOCKED. When committing a ledger block, the worker acquires a sub-millisecond PostgreSQL advisory lock (pg_advisory_xact_lock(hashtext(production_id))). Our stress tests prove that 12 concurrent workers processing simultaneously produce zero chain forks and 100% contiguous sequence ordering.
II. Deterministic JSON Serialization for Cryptographic Hashes
- Challenge: PostgreSQL
jsonbalters key ordering upon storage (e.g.{a:1, b:2}becomes{b:2, a:1}). Naive stringification causedverifyChainto fail on legitimate, un-tampered records. - Breakthrough: We engineered a recursive canonicalizer that lexicographically sorts all JSON keys across nested objects and arrays prior to SHA-256 calculation on both write and verify paths.
III. Zero Hallucination Citation Guarantee
- Challenge: LLMs under complex multi-turn reasoning can inadvertently emit plausible-looking citation URLs that were never actually retrieved during the search session.
- Breakthrough: We established a strict architectural gateway: retrieval strictly precedes reasoning, and reasoning is denied write access to the citation URL field. Only URLs present in the retrieved pool $P$ survive into the database.
What We're Proud Of
- Zero Fixture Data: There is not a single mock fixture or hardcoded mock response in the entire codebase. Every single finding, spend penny, activity event, and confidence score originates from live Vertex AI inference and Parallel web crawling.
- Adversarial Verification You Can Inspect: When the Continuity Verifier challenges a finding, the challenge, the follow-up investigation, and the revised verdict are logged transparently in the activity feed and ledger.
- One-Click Cryptographic Verification: Pressing "Verify Chain" recomputes every SHA-256 hash from stored rows. Our test suite deliberately disables the trigger, modifies a row as a database intruder would, and asserts that
verifyChainflags the exact sequence number that was compromised. - Honest Legal Boundaries: ClearFrame assists legal counsel—it does not replace them. Automated outreach drafts cannot be emailed autonomously, and final clearance reports cannot be certified without a human counsel's authenticated signature.
What's Next for ClearFrame
- Compounding Rights-Holder Knowledge Graph: Enriching controlling entities across productions into a unified counterparty graph, allowing future productions to resolve licensing desks instantly.
- Video Keyframe Multimodal Clearance: Ingesting proxy cuts (EDL/XML + MP4) to identify background logos, artwork, and cameos directly from video frames using Gemini 2.5 Pro multimodal vision.
- Timecode Heatmap Anchoring: Anchoring clearable cues to SMPTE timecodes, rendering an interactive clearance status bar beneath the post-production video timeline.
- Underwriting Pricing API: Providing anonymized claim outcome telemetry to E&O underwriters to programmatically discount insurance premiums for ClearFrame-certified productions.
Try It Out
- 🌐 Live Web Application: https://clearframe-web-690834564732.us-central1.run.app
- 📦 GitHub Repository: https://github.com/edish-github/ClearFrame
Built With
- cloud-run
- cloud-scheduler
- cloud-sql
- cloud-storage
- docker
- fastify
- gemini-2.5-flash
- gemini-2.5-pro
- google-cloud
- node.js
- parallel-ai
- postgresql
- react
- sse
- typescript
- vertex-ai
- vite
- zod

Log in or sign up for Devpost to join the conversation.