CLIP — Autonomous AI Cinema
https://clip.spboucher.ai — a small autonomous studio that conceives, writes, storyboards, shoots, narrates, edits, reviews and (after a human approval) publishes original short vertical films, with a public cinema to watch them and a private studio to run the production.
- Public cinema: vertical feed, editorial home, film pages with provenance and sources, series, explore, search, English and French.
- Private studio (
/studio): Concept Lab, script and research, storyboard, prompt workbench, timeline, preview, automated QA, approval and release, programming, budgets, kill switch, audit log. - Production engine: an eight-stage pipeline on a durable queue, real xAI integrations (Grok LLM, Grok Imagine image and video, text to speech), FFmpeg assembly, idempotent and budgeted provider calls.
What is live and what is not is stated plainly in PROGRESS.md.
Architecture in one picture
visitor ─▶ Caddy (TLS) ─▶ clip-web (Next.js 16: cinema, studio, API, media with range)
│ enqueue ▲ read
▼ │
Redis (BullMQ) ──▶ clip-worker ─┼─▶ PostgreSQL 17
│ FFmpeg │
▼ │
content-addressed asset store (disk)
│
▼ HTTPS, server side only
xAI: grok-4.7 · Grok Imagine · TTSIdea → Pitches → Research → Script → Storyboard → Keyframes → Voice → Video → Assembly → QA → Approval → ReleaseDetails: docs/architecture.md. Provider facts verified against the live API:
docs/provider-capabilities.md. Money: docs/cost-model.md.
Threat model: docs/security.md. Operations: docs/deployment.md.
Repository map
| Path | What it holds |
|---|---|
src/app/(public)/[locale]/ |
Public cinema (English at /, French at /fr) |
src/app/studio/ |
Studio pages and server actions |
src/app/api/ |
Public API, studio API, OpenAPI document (/api/openapi.json) |
src/app/media/[file]/ |
Media delivery with HTTP range; public only for published films |
src/providers/ |
Provider interfaces, xAI adapters, capability matrix, price table, HTTP layer (retries, breaker) |
src/pipeline/ |
Stages, prompts (agent roles), provider-job wrapper (idempotency, budget, resume), FFmpeg, captions, QA, publication, orchestrator |
src/worker/ |
Queue worker, programming scheduler, housekeeping, nightly backup |
src/lib/ |
Contracts (Zod), auth, budget, storage, queue, search, i18n, taxonomy |
db/migrations/ |
SQL schema |
scripts/ |
Migrate, seed, owner bootstrap, operator CLIs, backup/restore, CI gate, secrets scan |
tests/, e2e/ |
Unit tests (Vitest) and end-to-end tests (Playwright) |
Local setup
Requirements: Node 24+, pnpm, PostgreSQL 17, Redis, FFmpeg.
pnpm install
createdb clip_dev
cp .env.example .env # fill DATABASE_URL, ASSET_ROOT, APP_SECRET (openssl rand -hex 32), XAI_API_KEY, OWNER_EMAIL
pnpm migrate && pnpm seed
pnpm bootstrap:owner # prints a one-time password, to be replaced at first sign-in
pnpm build && pnpm start # web on http://localhost:8640
pnpm worker # in a second terminalSign in at /studio, replace the one-time password, turn on two-factor authentication in Account, then open
the Concept Lab.
Operator commands
pnpm tsx scripts/provider-probe.ts # live models and prices vs the compiled matrix (no paid call)
pnpm tsx scripts/produce.ts --theme "…" --series one-minute-ideas --lang fr --shots 4 --quality draft --until qa
pnpm tsx scripts/produce.ts --project <id> --publish --approver you@example.com
pnpm tsx scripts/kill-switch.ts on|off|status
scripts/backup.sh # database dump + asset copy (+ off-node rsync)
scripts/restore.sh ~/backups/clip-spboucher-ai # restore drill into a scratch database
scripts/ci.sh # typecheck, lint, unit tests, build, secrets scan (+ e2e with PW_BASE_URL)produce.ts runs the same stages inline, under the same budgets and idempotency rules as the worker. Publishing
from the CLI still requires naming a studio user as approver: release is a human decision.
How spending is controlled
- Every paid call goes through
runProviderJob(): budget gate → atomic claim → provider → ledger. - The gate enforces the kill switch and four ceilings (shot, film, day, month) on money spent plus money committed to running jobs. An unknown price blocks autonomous execution.
- The same input is paid for once: the idempotency key is a hash of (kind, model, input). Re-running a stage,
double-clicking, or a worker restart reuses the stored result; a crashed video job resumes from its provider
request_id. - Regenerating a shot is explicit, counted, and capped; past the cap an owner must approve.
- Nothing loops: the scheduler has a daily quota, retries are bounded, and a failed QA never retries itself.
Tests
pnpm test # unit: contracts, budget gate, pricing, captions, idempotency, SSRF allow-list…
PW_BASE_URL=https://clip.spboucher.ai pnpm test:e2e # public cinema, API contract, studio access controlLicence and content
Code: private. Films: AI-generated, © CLIP / Simon-Pierre Boucher. Voices are provider presets (no cloning); there is no third-party music; no real person is depicted.