Autonomous Script Clearance & Brand Protection Agent for Film, TV, and Streaming Productions
Live demo (CLOUD_MODE): https://clearancescout-n3tcx4jcbq-uc.a.run.app
First-time visitors in CLOUD_MODE can enter the documented judge access token judge-pass-2026 in the access modal to unlock live project data access, screenplay uploads, observable timeline streams, and clearance workflows.
ClearanceScout is an enterprise agentic platform designed for studio legal counsel, clearance coordinators, art directors, and production delivery supervisors. It transforms unstructured screenplays into structured, auditable clearance binders by automatically extracting brand marks, music compositions, public figures, proprietary locations, and prop graphics, grounding them against live USPTO and web trademark registries via Parallel Search, generating verified non-infringing replacement assets, and orchestrating comprehensive production clearance operating workflows.
Follow this quick workflow on the live Cloud Run deployment:
- Open the app: Navigate to https://clearancescout-n3tcx4jcbq-uc.a.run.app and enter judge access token
judge-pass-2026. - Create your isolated workspace: Click the project switcher in the header, then click "+ New Project" (e.g. "Judge Evaluation Project", Studio: "Apex Films"). This guarantees an isolated workspace and research quota.
- Upload a sample two-scene script: Click "Upload Screenplay", select the "Paste Text" tab (or save as
.txt), and paste the 10-line screenplay below:Click "Ingest Screenplay" to parse scenes and entities via Vertex Gemini.EXT. DOWNTOWN ROOFTOP - NIGHT ELENA stands near the edge of the neon-lit parapet. The city hums below. She reaches into her pocket and pulls out a sleek can of RED BULL. ELENA We only have until sunrise. INT. TECH LAB - CONTINUOUS MARCUS furiously types away at a dual-monitor workstation. A half-eaten pizza sits next to his glowing TERMINAL. MARCUS (without looking up) The firewall is down. We're in. - Live trademark research: In the Entity Registry table, click "Research" on Red Bull to watch live Parallel Search API citations appear with real source links.
- Export Binder: Open "Export Binder" in the header, verify preflight readiness, and click "Generate PDF Binder" to export the sealed clearance dossier.
- Ingests Fountain (
.fountain), Plaintext (.txt), and PDF screenplays. - Extracts and categorizes mentions across 5 critical clearance domains:
- ๐ท๏ธ
BRAND: Trademarks, consumer products, electronics, automotive. - ๐ต
ART_MUSIC: Copyrighted compositions, song lyrics, paintings, sculptures. - ๐ค
PUBLIC_FIGURE: Living real-world figures, celebrity depictions. - ๐๏ธ
PROPRIETARY_LOCATION: Trademarked architectural landmarks, private venues. โ ๏ธ GRAPHIC_PROP: Industrial placards, caution symbols, prop slogans.
- ๐ท๏ธ
- โClear once, recognize everywhereโ: Canonical registry resolves entity occurrences across scenes.
- Grounded directly via the official
parallel-web(^1.3.0) TypeScript SDK (direct backend integration, no MCP required). - Returns explicit structured
searchOutcomemetadata (ZERO_RESULTS|MATCHES_FOUND|SERVICE_FALLBACK) rather than relying on citation prose heuristics. - Retains exact source URLs, trademark owner details, registration statuses, and precedent snippets with verifiable provenance badges (
PARALLEL_LIVE๐,DEMO_FIXTURE๐ฆ,FALLBACK_FIXTUREโก,MIXED๐). - Strict anti-hallucination invariant: Never invents external web evidence or claims
TRADEMARK_ACTIVEwhen status is unconfirmed.
- Studio project organization categorized by
projectType(Movie,TV Show,Commercial). - Fast, multi-project switching with project-scoped entity registries, rights databases, and quota counters.
- Clearance risk is evaluated per scene occurrence using specific scene action context (dialogue sentiment, background vs foreground depiction, defamatory vs incidental use).
- Canonical entity status is deterministically derived from its most severe active occurrence status.
- Disambiguates brand aliases, product lines, and parent/subsidiary corporate relationships.
- Tracks material equivalence groups to eliminate redundant research and unify cross-scene clearance decisions.
- First-class tracking of executed licenses and agreements:
grantType(EXCLUSIVE,NON_EXCLUSIVE,GRATIS,WORK_FOR_HIRE),territory,mediaWindow,effectiveDate,expirationDate,isPerpetual, and contractual covenants.
- Mathematical readiness evaluation:
- ๐ข
FINAL CLEAR: 100% of scene occurrences are clean, covered by active rights, or signed off via counsel override. - ๐ก
WORKING CLEAR: All un-cleared items have temporary on-set approvals (TEMP_APPROVEDplaceholders). - ๐ด
RED: Scene has at least one unresolved clearance blocker (ACTION_REQUIRED).
- ๐ข
- Automated department task generation upon clearance state changes, routing work items to
Art Dept,Legal Counsel,Locations, andProduction Mgmt. - Automatic task resolution when mitigating rights or placeholders are attached.
- Multi-category replacement tracking for brands, music tracks, artworks, dialogue lines, and graphic props.
- Manages on-set
TEMP_APPROVEDvs post-productionFINAL_CLEAREDlifecycles.
- Closed-loop candidate clearance loop grounded in live Parallel Search trademark evidence.
- Accumulates negative prompt constraints upon collision, enforces a deterministic loop ceiling of
$\le 3$ attempts, and streams live 4-event SSE timelines (REPLACEMENT_ATTEMPT,REPLACEMENT_RESEARCH_STARTED,REPLACEMENT_REJECTED,REPLACEMENT_ACCEPTED).
- Executive operational cockpit surfacing active shooting blockers, upcoming rights expirations (
$\le 90$ days), active placeholders, scene readiness breakdown, and department work queues with direct 1-click mitigation shortcuts.
- Audit-grade legal delivery dossier compiling scene schedules, canonical entities, contractual rights, fictional placeholders, open action items, research citations, and signed counsel overrides.
- Deterministic 64-character SHA-256 cryptographic integrity digest ensuring tamper-evident provenance for studio E&O insurance.
- Export formats: Auditable JSON, formatted Markdown (
.md), and print-ready PDF.
- Manual entity addition, property editing with automatic assessment invalidation, and clean entity deletion.
- Granular retry for individual items returning
INSUFFICIENT_EVIDENCEwithout re-running entire scripts.
- Visual and legal comparison view contrasting original scripted items with approved fictional replacement prop cards.
- Instant client and API filtering across Clearance Status, Entity Category, and Scene Number with 1-click reset recovery.
- Direct navigation from exported binder dossiers into citation source drawers and observable action timeline events.
- High-throughput parallel evaluation (
$N=3$ ) with live progress broadcast and fail-visible item isolation.
- Bearer token security with client modal configuration, project-scoped live research quotas, and fail-visible 429 warnings.
- WCAG 2.1 AA accessible with full keyboard navigation (
Tab,Enter,Escape), high-contrast focus rings, touch targets ($\ge 44\text{px}$ ), and responsive mobile stacking.
- Single-click demo loading (
POST /api/projects/:id/script/demo) ingesting "The Neon Horizon", auto-running deterministic batch evaluations withDEMO_FIXTURE(๐ฆ) provenance, attaching active beverage rights (Summit Beverage Group LLC) and approved fictional placeholders (NovaTech Zenith), and computing scene readiness without requiring external API keys. - Immediately populates the Operations Dashboard and Legal Clearance Binder with realistic multi-scene metrics, department queues, and verifiable 64-character SHA-256 integrity seal.
CLOUD_MODEFail-Closed Rule: Unmitigated fallback fixtures and search failures in production runtime fail closed toINSUFFICIENT_EVIDENCEand scene status evaluates toRED.- Structured Search Outcomes: Parallel Search results return structured
searchOutcomemetadata (ZERO_RESULTS|MATCHES_FOUND|SERVICE_FALLBACK), isolating prose heuristics to legacy compatibility fallbacks. - Zero-Hit
PARALLEL_LIVEPrecision: Live search returning zero trademark hits is documented as completed live research withZERO_TRADEMARK_CONFLICTS_SURFACEDwithout inventing fictional corporate owners or registration classifications. - Baseline BRAND Non-Auto-Clear: Baseline / un-occurred brand evaluations never independently assign
NO_ISSUE_SURFACEDfrom absence of records; they evaluate asREVIEW_RECOMMENDED. RETRY_RESEARCHAction Routing: Items withINSUFFICIENT_EVIDENCEdispatch aRETRY_RESEARCHaction item for Legal Counsel and auto-resolve upon successful research retry.- Gemini Structured Scene Context: Gemini 3.6 Flash semantically interprets scene occurrence tone, prominence, and defamation risks while deterministic TypeScript logic maintains authoritative state ownership.
- Granular Scoped Placeholders: Supports occurrence-level and scene-level replacement scoping, preventing placeholders from over-mitigating un-scoped occurrences.
- Strict
WORKING_CLEARInvariant:WORKING_CLEARrequires affirmative interim mitigations; unmitigatedREVIEW_RECOMMENDEDoccurrences remain blockers until authorized. - Genuine Ingestion Diagnostics: Scanned or unparseable PDF uploads return structured
400 Bad Requestdiagnostics with codePDF_EXTRACTION_FAILED.
- Native File Picker & Multipart Upload: Native dialog and drag-and-drop file ingestion supporting
.fountain,.txt, and.pdffiles up to 25MB with visible error banners and SHA-256 checksums. - Windowed Chunk Parsing: Robust multi-scene chunking with 1-scene overlap buffers allowing seamless ingestion of 120+ page feature-length screenplays without LLM context overflows.
- Authoritative Server
CLOUD_MODEPrecedence: Server runtime execution mode is globally authoritative; client headers and persisted project flags cannot force demo fallbacks or override live AI evaluators. - Strict Model Error Visibility: In
CLOUD_MODE, Gemini parser exceptions fail visibly with structured diagnostic codePARSING_FAILEDrather than silently leaking demo recognizers. - Google Cloud Firestore ADC Persistence: Production runtime connects directly to Google Cloud Firestore via Application Default Credentials (ADC), failing health probes (
503 Service Unavailable) if the database is unreachable. - Protected Public Endpoints: Mutating endpoints (
/upload,/replacements,/overrides,/rights,/actions) are guarded with Bearer authentication while preserving public access for health checks and demo exploration. - Fail-Closed Replacement Candidate Gate: Gemini replacement candidate generation and collision checks fail closed on model exceptions, excluding failed/proposed replacements from interim mitigations.
- Strict Interim Mitigation Gating:
WORKING_CLEARinterim scene mitigation strictly requires placeholders inTEMP_APPROVEDorFINAL_CLEAREDtiers, or replacement cards with statusAPPROVEDandselfClearanceResult: ACCEPTED. - Atomic 25-Call Live Quota Accounting: Enforces atomic Firestore transaction boundaries so project live research quotas strictly honor the 25-call allocation under high concurrency.
- Worst-Case Canonical Status Roll-Up: Derived canonical entity status factors in all active occurrences across the script, preventing
NO_ISSUE_SURFACEDif any occurrence is non-cleared or unresolved (INSUFFICIENT_EVIDENCE). - Grounding Cache Invalidation & Clean Screenplay Draft Replacement: Entity edits immediately invalidate grounding caches; screenplay re-uploads execute an atomic replacement transaction that purges old scenes, re-indexes occurrences, and auto-supersedes orphaned action items (
SCRIPT_REVISION_SUPERSEDED).
graph TD
Client[Vite / React 18 SPA] -->|REST / SSE| Server[Express 4 Cloud Run Service]
subgraph Backend[server/ directory isolation]
Parser[ScriptParserAgent - Gemini 3.6 Flash]
Grounding[ParallelSearchTool - parallel-web SDK]
Evaluator[ClearanceEvaluator - Deterministic Math + Gemini]
Replacements[ReplacementGenerator - Closed-Loop Self-Clearance]
RightsEngine[RightsManagementWorkflow - Contractual Terms]
SceneEngine[SceneReadinessEngine - Deterministic RED/WORKING/FINAL]
ActionEngine[ActionDispatcher - Department Work Queues]
DashEngine[DashboardEngine - Operations Cockpit]
BinderEngine[BinderExportWorkflow - SHA-256 Audit Seal]
Artwork[ArtworkTool - Google Imagen 3]
Timeline[TimelineBroadcaster - SSE Event Stream]
Store[(Google Cloud Firestore)]
end
Server --> Parser
Server --> Grounding
Server --> Evaluator
Server --> Replacements
Server --> RightsEngine
Server --> SceneEngine
Server --> ActionEngine
Server --> DashEngine
Server --> BinderEngine
Server --> Artwork
Server --> Timeline
Server --> Store
- Gemini 3.6 Flash on Vertex AI: Semantic document understanding, occurrence context extraction, dialogue sentiment, and creative replacement generation.
- Deterministic TypeScript: Computes objective mathematical values (scene readiness status, expiration day deltas, override precedence, attempt counters, and SHA-256 checksums).
- Gemini 3.6 Flash on Vertex AI: Reasons over calculated outputs against legal specifications to issue final validation verdicts.
| Mode | Target | Description |
|---|---|---|
TEST_MODE |
Automated CI/CD | Deterministic local fixtures for instant, isolated unit and contract testing (152/152 tests pass). |
DEMO_MODE |
Interactive Evaluation | Zero-configuration evaluation using synthetic datasets and bundled demo screenplay ("The Neon Horizon"). |
CLOUD_MODE |
Production Runtime | Live Google Gemini 3.6 Flash on Vertex AI and Parallel Search APIs. Fails visibly with diagnostics if credentials/project are missing. |
- Node.js 20+
- npm 10+
git clone https://github.com/fmcgoohan/clearancescout.git
cd clearancescout
npm installnpm testExecutes all 152 tests across 74 test files spanning contract and integration suites with 0 failures.
# Build production bundle
npm run build
# Start local server
npm startOpen http://localhost:8080 to access the ClearanceScout Studio Workspace.
Live service (CLOUD_MODE): https://clearancescout-n3tcx4jcbq-uc.a.run.app
GCP project: clearance-scout-2026. Service: clearancescout in us-central1.
ClearanceScout is packaged as a single unified container serving both the Express REST/SSE API and compiled static React frontend.
The Cloud Run runtime service account requires the roles/aiplatform.user role to invoke Gemini 3.6 Flash on Vertex AI without an API key:
gcloud projects add-iam-policy-binding clearance-scout-2026 \
--member="serviceAccount:clearance-scout-runtime@clearance-scout-2026.iam.gserviceaccount.com" \
--role="roles/aiplatform.user" \
--condition=Nonegcloud run deploy clearancescout \
--image gcr.io/clearance-scout-2026/clearancescout:<IMAGE_TAG> \
--project clearance-scout-2026 \
--platform managed \
--region us-central1 \
--allow-unauthenticated \
--port 8080 \
--set-env-vars "EXECUTION_MODE=CLOUD_MODE,GEMINI_BACKEND=vertex,GOOGLE_CLOUD_PROJECT=clearance-scout-2026,GOOGLE_CLOUD_LOCATION=us-central1" \
--set-secrets "PARALLEL_WEB_API_KEY=clearance-parallel-api-key:latest,DEMO_ACCESS_TOKEN=clearance-demo-access-token:latest"Missing production credentials must fail visibly. Do not silently substitute DEMO fixtures in CLOUD_MODE.
If Vertex AI needs to be reverted to the API key backend without downtime:
- Re-attach the
GEMINI_API_KEYsecret from Secret Manager. - Set environment variable
GEMINI_BACKEND=apikey.
gcloud run services update clearancescout \
--region us-central1 \
--project clearance-scout-2026 \
--update-env-vars "GEMINI_BACKEND=apikey" \
--update-secrets "GEMINI_API_KEY=clearance-gemini-api-key:latest"curl -s https://clearancescout-n3tcx4jcbq-uc.a.run.app/api/healthClearanceScout provides automated issue-spotting, trademark research provenance, and clearance workflow management. It does not render formal legal opinions or replace independent legal counsel. Production counsel should independently review all chain-of-title and rights documents prior to distribution.
